﻿namespace T.FAS.Runtime.Base.SPI
{
    public class FASMaskConfig
    {

        /// <summary>
        /// 掩码规则标识，guid所有规则运行时取
        /// </summary>
        public string ID { get; set; }

        /// <summary>
        /// 掩码规则名称
        /// </summary>
        public string RuleName { get; set; }

        /// <summary>
        /// 正则表达式匹配规则
        /// </summary>
        public string RegPattern { get; set; }

        /// <summary>
        /// 替换值
        /// </summary>
        public string Replacement { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public int Sort { get; set; }

        public static FASMaskConfig Mapping(SYSMaskConfig sysCfg, int sort = 0)
        {
            return new FASMaskConfig
            {
                ID = sysCfg.Type,
                RuleName = sysCfg.Description,
                RegPattern = sysCfg.Pattern,
                Replacement = sysCfg.Replacement,
                Sort = sort
            };
        }
    }
}
